<template>
	<view class="app">
		<view class="cell">
			<text class="tit fill">手机号</text>
			<input class="input" type="text" v-model="mobile" maxlength="11" placeholder="请输入手机号" placeholder-class="placeholder">
		</view>
		<!-- <button class="add-btn" @click="confirm('add')" style="background-color: #fa436a !important;">保存资料</button> -->
		<view style="height: 100rpx;"></view>
		<button class="add-btn" style="background: #0066FF;color: #FFFFFF;margin:5px 15px" @click="confirm">保存</button>
	</view>
</template>

<script>
import { onMounted } from "vue";
	export default {
		data() {
			return {
				uploadProgress: 100, //头像上传进度
				tempAvatar: '',
				userInfo: {},
				dateString: '',
				type: 'date',
				mobile:'',
			}
		},
		computed: {
			indicatorStyle() {
				return {
					background: 'rgba(255,0,0,.2)',
					height: '40px',
				};
			}
		},
		onLoad(option) {
			uni.hideHomeButton()
			this.mobile = option.mobile
		},
		methods: {
			//提交修改
			async confirm() {
				const that = this
				if (!this.mobile) return this.$fun.msg('请输入手机号');
				const res = await this.$fun.ajax.post('/user/changemobile',{ mobile:this.mobile
				}).then(res => {
					if (res.code == 1) {
						this.$fun.msg(res.msg)
						setTimeout(()=>{
							uni.reLaunch({
								url: '/pages/index/index'
							})
						},1000)
					}
				})
			}
		},
	}
		
</script>

<style scoped lang="scss">
	page {
		background: rgb(255, 255, 255);
	}

	.app {
		padding-top: 16rpx;
	}

	.cell {
		display: flex;
		align-items: center;
		min-height: 110rpx;
		margin: 0 40rpx;
		border-bottom: 1px solid rgb(236, 236, 236);

		&:first-child {
			margin-bottom: 10rpx;
		}

		&:after {
			left: 40rpx;
			right: 40rpx;
			border-color: #d8d8d8;
		}

		.tit {
			font-size: 30rpx;
			color: #333;
		}

		.avatar-wrap {
			width: 120rpx;
			height: 120rpx;
			position: relative;
			border-radius: 100rpx;
			overflow: hidden;

			.avatar {
				width: 100%;
				height: 100%;
				border-radius: 100rpx;
			}

			.progress {
				position: absolute;
				left: 50%;
				top: 50%;
				transform: translate(-50%, -50%);
				width: 100rpx;
				height: 100rpx;
				box-shadow: rgba(0, 0, 0, .6) 0px 0px 0px 2005px;
				border-radius: 100rpx;
				transition: .5s;
				opacity: 0;

				&.no-transtion {
					transition: 0s;
				}

				&.show {
					opacity: 1;
				}
			}
		}

		.input {
			margin-left: 10rpx;
			font-size: 28rpx;
			color: #333;
		}

		switch {
			margin: 0;
			transform: scale(0.8) translateX(10rpx);
			transform-origin: center right;
		}

		.tip {
			margin-left: 20rpx;
			font-size: 28rpx;
			color: #999;
		}

		.checkbox {
			padding: 12rpx 0 12rpx 40rpx;
			font-size: 28rpx;
			color: #333;

			.mix-icon {
				margin-right: 12rpx;
				font-size: 36rpx;
				color: #ccc;
			}

			.icon-xuanzhong {
				color: $base-color;
			}
		}
	}
</style>
